﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace Realtors.Web.UI.Models
{
    public class HouseSummaryModel
    {
        [HiddenInput]
        public Guid HouseID { get; set; }
        [Display(Name = "Title", ResourceType = typeof(Resources))]
        public string Title { get; set; }
        [Display(Name = "NoOfRooms", ResourceType = typeof(Resources))]
        public int NoOfRooms { get; set; }
        [Display(Name = "NoOfBathrooms", ResourceType = typeof(Resources))]
        public int NoOfBathrooms { get; set; }
        [Display(Name = "SquareFeet", ResourceType = typeof(Resources))]
        public double SquareFeet { get; set; }
        [Display(Name = "Price", ResourceType = typeof(Resources))]
        public decimal Price { get; set; }

        [HiddenInput]
        public bool IsSale { get; set; }

        private string _description;
        [Display(Name = "Description", ResourceType = typeof(Resources))]
        public string Description
        {
            get
            {
                return _description;
            }
            set
            {
                if (value.Length > 100)
                {
                    _description = value.Substring(0, 99) + "...";
                }
                else
                    _description = value;
            }
        }

        public List<string> PropertyPhotos { get; set; }
        [Display(Name = "StreetAddress", ResourceType = typeof(Resources))]
        public string StreetAddress { get; set; }
        [Display(Name = "City", ResourceType = typeof(Resources))]
        public string City { get; set; }
        [Display(Name = "State", ResourceType = typeof(Resources))]
        public string State { get; set; }
        [Display(Name = "Country", ResourceType = typeof(Resources))]
        public string Country { get; set; }

        public int TotalVisits { get; set; }
        public string SalesType
        {
            get
            {
                if (this.IsSale == true)
                    return Resources.ForSale;
                else
                    return Resources.ForRent;
            }
        }
        public HouseSummaryModel()
        {
            PropertyPhotos = new List<string>();
        }

        public string AdDate { get; set; }
    }
}